package org.brain.bean;

import javax.faces.application.ConfigurableNavigationHandler;
import javax.faces.application.NavigationCase;
import javax.faces.application.NavigationHandler;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
import javax.faces.context.FacesContext;

import org.brain.tool.ToolBean;

@ManagedBean(name="navBean")
@RequestScoped
public class NavBean {
	
	public String URL;
	public String LoadURL()
	{
		String id;
		id = ToolBean.getRequestParameter("id");
		FacesContext fc = FacesContext.getCurrentInstance();
		NavigationHandler nh = fc.getApplication().getNavigationHandler();
		  ConfigurableNavigationHandler navigationHandler = (ConfigurableNavigationHandler) nh;

          NavigationCase navCase = navigationHandler.getNavigationCase(fc, null,"DataTable.xhtml?id"+id);
		
		return navCase.getToViewId(fc);
	}

	public String getURL() {
		URL = LoadURL();
		return URL;
	}

	public void setURL(String uRL) {
		URL = uRL;
	}
	

}
